<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>乐淘-商品管理</title>
	<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="assets/font-awesome/css/font-awesome.min.css">
	<link rel="stylesheet" href="css/system.css">
	<script src="assets/jquery/jquery.min.js"></script>
	<script src="assets/bootstrap/js/bootstrap.min.js"></script>
	<script src="assets/artTemplate/template-native.js"></script>
	<script src="assets/jquery-fileupload/jquery.ui.widget.js"></script>
	<script src="assets/jquery-fileupload/jquery.iframe-transport.js"></script>
	<script src="assets/jquery-fileupload/jquery.fileupload.js"></script>
	<script src="js/common.js"></script>
	<script src="js/product.js"></script>
</head>
<body>
	<div class="system">
		<div class="aside">
			<div class="profile">
				<div class="avatar img-circle">
					<img src="images/my_logo.jpg">
				</div>
				<h4>张学友</h4>
			</div>
			<div class="navs">
				<ul class="list-unstyled">
					<li>
						<a href="user.html">
							<i class="fa fa-user"></i>
							用户管理
						</a>
					</li>
					<li>
						<a href="javascript:;">
							<i class="fa fa-bars"></i>
							分类管理
							<i class="fa fa-angle-right"></i>
						</a>
						<ul class="list-unstyled">
							<li>
								<a href="category-first.html">一级分类管理</a>
							</li>
							<li>
								<a href="category-second.html">二级分类管理</a>
							</li>
						</ul>
					</li>
					<li class="active">
						<a href="product.html">
							<i class="fa fa-product-hunt"></i>
							商品管理
						</a>
					</li>
				</ul>
			</div>
		</div>
		<div class="main">
			<div class="header">
	            <nav class="navbar navbar-custom">
	                <div class="navbar-header">
	                    <a href="javascript:;" class="navbar-brand">
	                        <i class="fa fa-navicon"></i>
	                    </a>
	                </div>
	                <ul class="nav navbar-nav navbar-right">
	                    <li>
	                        <a href="javascript:;" class="login_out_bot">
	                            <i class="fa fa-sign-out"></i> 退出
	                        </a>
	                    </li>
	                </ul>
	            </nav>
	        </div>
	        <div class="body">
	        	<button class="operation btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">添加商品</button>
	        	<table class="table table-bordered" id="productBox"></table>
	        	<div class="btn-group page">
	        		<div class="btn btn-default" id="prevBtn">上一页</div>
	        		<div class="btn btn-default" id="nextBtn">下一页</div>
	        	</div>
	        </div>
		</div>
	</div>
	
	<div class="modal fade bs-example-modal-lg">
	  <div class="modal-dialog modal-lg">
	    <div class="modal-content">
	    	<div class="modal-header">
	    		<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
	    		<h4 class="modal-title" id="myLargeModalLabel">添加商品</h4>
	    	</div>
	    	<div class="modal-body">
	    		<div class="form-group" id="brandBox"></div>
	    		<div class="form-group">
	    			<input id="productName" type="text" class="form-control" placeholder="请输入产品名称">
	    		</div>
	    		<div class="form-group">
	    			<input id="productDescription" type="text" class="form-control" placeholder="请输入产品描述">
	    		</div>
	    		<div class="form-group">
	    			<input id="productNum" type="text" class="form-control" placeholder="请输入产品数量">
	    		</div>
	    		<div class="form-group">
	    			<input id="productSize" type="text" class="form-control" placeholder="请输入产品尺码,如29-39">
	    		</div>
	    		<div class="form-group">
	    			<input id="productOriginPrice" type="text" class="form-control" placeholder="请输入商品原价">
	    		</div>
	    		<div class="form-group">
	    			<input id="productNowPrice" type="text" class="form-control" placeholder="请输入商品折扣">
	    		</div>
	    		<div class="form-group">
	    		   <input type="file" accept="image/jpeg" name="pic1" multiple data-url="/product/addProductPic" id="fileUpload">
	    		   <p class="help-block">最多上传三张图片</p>
	    		   <div class="row" id="imgBox"></div>
	    		</div>
	    	</div>
	    	<div class="modal-footer">
	    		<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
	    		<button type="button" class="btn btn-primary" id="addProduct">添加</button>
	    	</div>
	    </div>
	  </div>
	</div>

	<script id="productTpl" type="text/html">
		<tr>
			<th>商品编号</th>
			<th>商品名称</th>
			<th>商品描述</th>
			<th>商品库存</th>
			<th>商品尺寸</th>
			<th>是否下架</th>
			<th>操作</th>
		</tr>
		<% for(var i=0;i<data.rows.length;i++){ %>
			<tr>
				<td><%=data.rows[i].id %></td>
				<td><%=data.rows[i].proName %></td>
				<td><%=data.rows[i].proDesc %></td>
				<td><%=data.rows[i].num %></td>
				<td><%=data.rows[i].size %></td>
				<td><%=data.rows[i].statu == 1 ? '已上架' : '已下架'  %></td>
				<td>
					<button type="button" class="btn btn-danger">下架</button>
				</td>
			</tr>
		<% } %>
	</script>

	<script id="brandTpl" type="text/html">
		<select class="form-control" id="brandOptions">
			<option value="-1">-- 请选择品牌 --</option>
			<% for(var i=0;i<data.rows.length;i++){ %>
				<option value="<%=data.rows[i].categoryId %>"><%=data.rows[i].brandName %></option>
			<% } %>
		</select>
	</script>

	<script id="imgsTpl" type="text/html">
		<% for(var i=0;i<data.length;i++){ %>
		<div class="col-xs-6 col-md-3">
			<div  class="thumbnail">
				<img src="<%=data[i].picAddr %>">
			</div>
		</div>
		<% } %>
	</script>
</body>
</html>